<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L797" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.toJson</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-tojson-page"><p>Serializes input into a JSON-formatted string. Properties with leading $ characters will be
stripped since angular uses this notation internally.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.toJson(obj[, pretty]);</pre>
<h4 id="parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>obj</td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-array">Array</a><a href="" class="label type-hint type-hint-date">Date</a><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="angular-tojson-page"><p>Input to be serialized into JSON.</p>
</div></td></tr><tr><td>pretty <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-tojson-page"><p>If set to true, the JSON output will contain newlines and whitespace.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string|undefined</a></td><td><div class="angular-tojson-page"><p>JSON-ified string representing <code>obj</code>.</p>
</div></td></tr></table></div>
</div>
